/*
 * Title: 城市正视图（Urban Elevations）
 * Author: Yuanshun L
 * Created : 16-otc-2021
 */


#include<cstdio>
#include<iostream>
#include<set>
#include<vector>
#include<map>
#include<algorithm>
#include<string>
#include<cstring>
using namespace std;

#define MAXN 101

struct Building{
    int id;
    double x,y,width,depth,height;
};

int n; // n是建筑物的数量
Building bs[MAXN]; // 所有建筑物
double x[MAXN*2]; // 所有的x坐标（一个建筑物的左下角和右下角）

bool operator<(const Building & b1, const Building & b2){
    return b1.x < b2.x || (b1.x == b2.x && b1.y < b2.y) ;
}

bool is_attached(int i,double xx){
    if(xx<bs[i].x||xx>bs[i].x+bs[i].width)
        return false;
    return true;
}

// 建筑物在x点是否可见
bool is_visible(int i, double xx){
    for(int k=0;k<n;k++){
        bool condition = bs[k].y < bs[i].y && bs[k].height >= bs[i].height && is_attached(k,xx);
        // xx被遮住
        if(condition) return false;
    }
    return true;
}


int main(){

    freopen("data.in","r",stdin);
    freopen("data.out","w",stdout);



    // 遍历每个地图
    int rnd = 0;
    while(cin>>n && n){
        int id=1,i=0,k=n;
        while(k--){
            Building b;
            cin>>b.x >> b.y >> b.width >> b.depth >> b.height;
            b.id = id++;
            bs[i]=b;
            x[i*2] = b.x;
            x[i*2+1] = b.x + b.width;
            i++;
        }

        int m = unique(x,x+n*2) - x; // 去重复之后，得到m个坐标
        sort(x,x+m);
        sort(bs,bs+n);

        if(rnd++) cout<<endl;
        // 对每个建筑物进行判定
        cout << "For map #%d, the visible buildings are numbered as followed:"<<endl;
        cout << bs[0].id;
        for(i=1;i<n;i++){
            bool flag = false;
            for(int j=1;j<m;j++){
                double middle =  (x[j]+x[j-1])/2;
                if(is_attached(i,middle) && is_visible(i,middle)){
                    flag = true; break;
                }
            }
            if(flag) cout<<" "<<bs[i].id;
        }
    }
    return 0;
}
